﻿using System;
using Loki.IoC.Registration;

namespace Loki.IoC
{
    /// <summary>
    /// Common interface for object contexts.
    /// </summary>
    public interface IObjectContext : IObjectCreator, IDisposable
    {
        /// <summary>
        /// Initializes the context with the specified installers.
        /// </summary>
        /// <param name="installers">The installers.</param>
        void Initialize(params IContextInstaller[] installers);

        /// <summary>
        /// Defines the type for creation.
        /// </summary>
        /// <typeparam name="I">Generic type.</typeparam>
        /// <typeparam name="T">Concrete type.</typeparam>
        void Register<T>(ElementRegistration<T> definition) where T : class;

        /// <summary>
        /// Releases the specified object.
        /// </summary>
        /// <param name="objectToRelease">The object.</param>
        void Release(object objectToRelease);

        /// <summary>
        /// Resets the context.
        /// </summary>
        void Reset();
    }
}